
import request from '@/utils/request'

// 获取员工简单列表
export function getEmployeeSimple() {
  return request({
    url: '/sys/user/simple'
  })
}

export function getEmployeeList(params) {
  return request({
    url: '/sys/user',
    method: 'get',
    params
  })
}

export function uploadEmp(data) {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data
  })
}
export function delEmployee(id) {
  return request({
    url: `/sys/user/${id}`,
    method: 'delete'
  })
}
export function addEmployee(data) {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}
export function getEmployeeinfo(id) {
  return request({
    url: '/sys/user/' + id,
    method: 'get'

  })
}
export function saveEmployeeinfo(data) {
  return request({
    url: '/sys/user/' + data.id,
    method: 'put',
    data

  })
}

export function getEmployeeDetailInfo(id) {
  return request({
    url: '/employees/' + id + '/personalInfo',
    method: 'get'

  })
}
export function saveEmployeeDetailinfo(data) {
  return request({
    url: '/employees/' + data.userId + '/personalInfo',
    method: 'put',
    data

  })
}

export function getEmployeeJob(id) {
  return request({
    url: '/employees/' + id + '/jobs',
    method: 'get'
  })
}

export function saveEmployeeJob(data) {
  return request({
    url: '/employees/' + data.userId + '/jobs',
    method: 'put',
    data
  })
}

export function putEmployeeRole(data) {
  return request({
    url: '/sys/user/assignRoles',
    method: 'put',
    data
  })
}
